/**
 * @file   1120.cpp
 * @author Shuang Hu <hsmath@ubuntu>
 * @date   Mon May 17 20:26:07 2021
 * 
 * @brief  PAT 1120
 * 
 * 
 */
#include<iostream>
#include<cmath>
#include<string>
#include<set>
using namespace std;
int main(){
    int N;
    cin>>N;
    set<int> S;
    for(int i=0;i<N;i++){
	string s;
	cin>>s;
	int sum=0;
	for(int j=0;j<s.length();j++){
	    sum=sum+s[j]-'0';
	}
	S.insert(sum);
    }
    cout<<S.size()<<endl;
    cout<<*S.begin();
    for(auto it=S.begin();it!=S.end();it++){
	if(it!=S.begin()){
	cout<<" "<<*it;
	}
    }
    cout<<endl;
}
